import os, sys
from distutils import dir_util as dir_util

def main():
    if not os.path.exists(os.path.join(os.path.expanduser('~'), '.mediaplex')):
        try:
            copy_defaults = dir_util.copy_tree(os.path.join(sys.path[0], 'defaults'), os.path.join(os.path.expanduser('~'), '.mediaplex'))
            main()
        except: 
            print 'No default configuration files found, check if /defaults/ exists'
    else: 
        import base.config.config as config
        if not os.path.exists(config.get_option('app.library', 'paths', 'str')):
            print 'Browse to ~/.mediaplex/, open mediaplex.conf and add a media folder under section paths of [app.library]'
        else:
            import plugins.data
            import base.application as application
            application.Application()
            
if __name__ == "__main__":
    main()